package com.huluobo.day_1_lifecycledemo.room;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.PrimaryKey;

/**
 * 1. @Entity 标记一个实体类创建对应的数据库的表
 * 2. @PrimaryKey(autoGenerate = true) 标记一个属性为主键自增
 * 3. @ColumnInfo(name = "_loginAccount") 标记一个属性为列名(字段)
 * 4. 创建表的时候,尽量不要嵌套类,比如油焖大虾接口,单独写一个类来做表
 */
@Entity(tableName = "Account")
public class AccountBean {
    @PrimaryKey(autoGenerate = true)
    public int accountId = 0;

    @ColumnInfo(name = "_loginAccount")
    public String loginAccount;

    @ColumnInfo(name = "_loginPassword")
    public String loginPassword;

    @ColumnInfo(name = "_loginIpAddress")
    public String loginIpAddress;

    @ColumnInfo(name = "_loginAge")
    public String loginAge;

    public AccountBean(String loginAccount, String loginPassword) {
        this.loginAccount = loginAccount;
        this.loginPassword = loginPassword;
    }
}
